package com.artPreter.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.artPreter.pojo.InputDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.artPreter.pojo.vos.page.InputDevicePageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 输入设备表 Mapper 接口
 * </p>
 *
 * @author Jarvis_He
 * @since 2024-04-22
 */
@Mapper
public interface InputDeviceMapper extends BaseMapper<InputDevice> {

    @Select("select s.*," +
            "b.posi_name as posiName,b.indoor as indoor," +
            "c.floor_name as floorName, " +
            "e.room_name as roomName " +
            "from jv_input_device s " +
            "left join jv_position b on s.position = b.uuid " +
            "left join jv_floor c on s.floor = c.uuid " +
            "left join jv_room e on s.room = e.uuid " +
            "${ew.customSqlSegment}")
    IPage<InputDevicePageVO> getPage(IPage<InputDevicePageVO> iPage, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Select("select s.*," +
            "b.posi_name as posiName,b.indoor as indoor," +
            "c.floor_name as floorName, " +
            "e.room_name as roomName " +
            "from jv_input_device s " +
            "left join jv_position b on s.position = b.uuid " +
            "left join jv_floor c on s.floor = c.uuid " +
            "left join jv_room e on s.room = e.uuid " +
            "${ew.customSqlSegment}")
    List<InputDevicePageVO> getList(@Param(Constants.WRAPPER) Wrapper wrapper);
}
